<template>
	<view>
		<view class="container">
			<image class="subject-cover"
				src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2350817201,1137116540&fm=26&gp=0.jpg"
				mode="widthFix"></image>
			<!--专题头部-->
			<view class="subject">
				<view class="title">这里是 {{form.name}}</view>
				<view class="summary">{{form.introduction}}</view>
				<view class="info">
					<text class="text">章节数：10章</text>
					<text class="text">浏览量：100</text>
				</view>
			</view>
			<!--列表-->
			<view class="list">
				<card :data='item' v-for="(item, index) in list" :key="index"></card>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					name: '',
					introduction: '',
					informationCategoryId: '',
					img: '',
					createTime: ''
				},
				list: []
			};
		},
		methods: {
			async getList() {
				let id = this.form.informationCategoryId
				let res =  await this.$API.informationApi.getList(id)
				
				this.list = res.list
				
				/*  */
				// this.request({
				// 	url: `/information/list?categoryId=${id}`,
				// }).then(res => {
				
				// 	console.log(this.list, "this.listthis.list");
				// })
			}
		},
		onShow() {
		},
		onLoad(options) {
			console.log(options, "options")
			let data =  (JSON.parse(decodeURIComponent(options.data))) 
			this.form = {
				...data
			}
			/*  */
			this.getList()
			/*  */
			uni.setNavigationBarTitle({
				title: this.form.name
			});
		}
	}
</script>

<style lang="scss" scoped>
	.subject-cover {
		width: 100%;
	}

	.subject {
		margin-bottom: 20rpx;
		background-color: #FFF;
		padding: 20rpx 30rpx 30rpx;
		box-shadow: 0 8rpx 4rpx #F5F5F5;

		.title {
			font-size: 32rpx;
			font-weight: bold;
		}

		.summary {
			color: #777;
			margin: 10rpx 0;
			font-size: 24rpx;
		}

		.text {
			color: #999;
			font-size: 24rpx;
			margin-right: 40rpx;
		}
	}
</style>